package tcpdemo.tcptest;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        // 创建Socket对象
        ServerSocket s = new ServerSocket(10000);

        // 等待客户端连接
        Socket accept = s.accept();

        // 获取输出流对象
        InputStream is = accept.getInputStream();
        byte[] bytes = new byte[1024];
        int b;
        while ((b = is.read(bytes)) != -1){
            System.out.println(new String(bytes));
        }

        //
        s.close();
        is.close();

    }
}
